﻿@{
    Layout = "";
}
@model Nop.Plugin.Shipping.Fedex.Models.FedexShippingModel
@using Nop.Web.Framework;
@using Nop.Plugin.Shipping.Fedex;
@using (Html.BeginForm())
{
    
<script type="text/javascript">
    $(document).ready(function () {

        $("#PackingType").change(togglePackingType);
        
        togglePackingType();
    });

    function togglePackingType() {
        var selectedPackingType = document.getElementById('PackingType');
        var selectedPackingTypeId = selectedPackingType.options[selectedPackingType.selectedIndex].value;
        if (selectedPackingTypeId == @(((int)PackingType.PackByDimensions).ToString())) {
            $('#pnlPassDimensions').show();
            $('#pnlPackingPackageVolume').hide();
        }
        else if (selectedPackingTypeId == @(((int)PackingType.PackByOneItemPerPackage).ToString())) {
            $('#pnlPassDimensions').hide();
            $('#pnlPackingPackageVolume').hide();
        }
        else if (selectedPackingTypeId == @(((int)PackingType.PackByVolume).ToString())) {
            $('#pnlPassDimensions').hide();
            $('#pnlPackingPackageVolume').show();
        }
    }
</script>
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.Url):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Url)
                @Html.ValidationMessageFor(model => model.Url)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.Key):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Key)
                @Html.ValidationMessageFor(model => model.Key)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.Password):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Password)
                @Html.ValidationMessageFor(model => model.Password)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AccountNumber):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AccountNumber)
                @Html.ValidationMessageFor(model => model.AccountNumber)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.MeterNumber):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.MeterNumber)
                @Html.ValidationMessageFor(model => model.MeterNumber)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AvailableDropOffTypes):
            </td>
            <td class="adminData">
                @Html.DropDownList("DropoffType", Model.AvailableDropOffTypes)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.UseResidentialRates):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.UseResidentialRates)
                @Html.ValidationMessageFor(model => model.UseResidentialRates)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ApplyDiscounts):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ApplyDiscounts)
                @Html.ValidationMessageFor(model => model.ApplyDiscounts)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AdditionalHandlingCharge):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AdditionalHandlingCharge)
                @Html.ValidationMessageFor(model => model.AdditionalHandlingCharge)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AvailableCarrierServices):
            </td>
            <td class="adminData">
                <div style="height: 250px; width: 300px; overflow: auto; border: solid 1px #bbb;">
                    @foreach (var csd in Model.AvailableCarrierServices)
                    {
                        <input type="checkbox" name="CheckedCarrierServices" value="@(csd)" @(Model.CarrierServicesOffered.Contains(csd) ? Html.Raw(" checked=\"checked\"") : null) />
                        <label>@csd</label>
                        <br />
                    }
                </div>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.Street):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Street)
                @Html.ValidationMessageFor(model => model.Street)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.City):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.City)
                @Html.ValidationMessageFor(model => model.City)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.StateOrProvinceCode):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.StateOrProvinceCode)
                @Html.ValidationMessageFor(model => model.StateOrProvinceCode)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PostalCode):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.PostalCode)
                @Html.ValidationMessageFor(model => model.PostalCode)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CountryCode):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CountryCode)
                @Html.ValidationMessageFor(model => model.CountryCode)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PackingTypeValues):
            </td>
            <td class="adminData">
                @Html.DropDownList("PackingType", Model.PackingTypeValues)
            </td>
        </tr>
        <tr id="pnlPassDimensions">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PassDimensions):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.PassDimensions)
                @Html.ValidationMessageFor(model => model.PassDimensions)
            </td>
        </tr>
        <tr id="pnlPackingPackageVolume">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PackingPackageVolume):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.PackingPackageVolume)
                @Html.ValidationMessageFor(model => model.PackingPackageVolume)
            </td>
        </tr>
        <tr>
            <td colspan="2" width="100%">
                <button type="submit" name="save" value="save" class="t-button">
                    @T("Admin.Common.Save")</button>
            </td>
        </tr>
    </table>    
}